// 定义电脑配件的类型接口

// 通用配件接口，用于所有配件类型的公共属性
export interface PCComponent {
  id: string;
  name: string;
  price: number; // 元
  performanceScore: number; // 性能评分 0-100
  image: string; // 预览图URL
}

// CPU类型定义
export interface CPU extends PCComponent {
  brand: 'Intel' | 'AMD';
  coreCount: number;
  threadCount: number;
  baseFrequency: number; // GHz
  boostFrequency: number; // GHz
  socketType: string;
  tdp: number; // W
}

// GPU类型定义
export interface GPU extends PCComponent {
  brand: 'NVIDIA' | 'AMD';
  memory: number; // GB
  memoryType: string;
  coreClock: number; // MHz
  boostClock: number; // MHz
  tdp: number; // W
}

// 内存类型定义
export interface RAM extends PCComponent {
  capacity: number; // GB
  type: string; // DDR4, DDR5等
  frequency: number; // MHz
  modules: number; // 模组数量
}

// 主板类型定义
export interface Motherboard extends PCComponent {
  socketType: string;
  chipset: string;
  memorySlots: number;
  memoryType: string;
  formFactor: string; // ATX, Micro-ATX等
}

// 存储类型定义
export interface Storage extends PCComponent {
  type: 'SSD' | 'HDD';
  capacity: number; // GB
  readSpeed: number; // MB/s
  writeSpeed: number; // MB/s
}

// 电源类型定义
export interface PowerSupply extends PCComponent {
  wattage: number; // W
  efficiency: string; // 80+ Bronze, Silver, Gold等
  modular: 'Full' | 'Semi' | 'Non-Modular';
}

// 机箱类型定义
export interface Case extends PCComponent {
  formFactor: string;
  maxGpuLength: number; // mm
  maxCpuCoolerHeight: number; // mm
}

// CPU散热器类型定义
export interface CpuCooler extends PCComponent {
  type: 'Air' | 'Liquid';
  compatibility: string[]; // 兼容的CPU接口
  height: number; // mm
  tdpSupport: number; // W
}

// 电脑配置类型定义
export interface PCBuild {
  cpu?: CPU;
  gpu?: GPU;
  ram?: RAM;
  motherboard?: Motherboard;
  storage?: Storage;
  powerSupply?: PowerSupply;
  pcCase?: Case;
  cpuCooler?: CpuCooler;
}

// 兼容检查结果类型
export interface CompatibilityResult {
  isCompatible: boolean;
  incompatibilityReasons: string[];
}

// 推荐方案类型
export interface Recommendation {
  name: string;
  description: string;
  totalPrice: number;
  performanceScore: number;
  build: PCBuild;
}